import Base from 'models/base';

export default class MajorTypeForm extends Base {
  majorName = '';

  constructor(major){
    super();

    if (major === undefined) {
      return;
    }
    this.majorName = major.majorName;
    this.majorTypeId = major.majorTypeId;
  }

  checkValid(){
    let fields = ['majorName'];
    return this.checkRequired(fields);
  }

  getObject(){
    let postData = {};
    let fields = ['majorName'];
    this.setPostData(postData, fields, true);

    let majorTypeId = this.majorTypeId;
    if (majorTypeId !== undefined) {
      postData.majorTypeId = majorTypeId;
    }

    return postData;
  }
}